using System;
using Microsoft.Web.Management.Server;
using Microsoft.Web.Management.Iis.Client;

namespace Microsoft.Web.Management.Iis.Server
{

    /// <summary>
    /// Represents the module provider for IIS Logging
    /// </summary>
    public sealed class LoggingModuleProvider
        : ModuleProvider
    {
        /// <summary>
        /// Gets the service type for this module.
        /// </summary>
        public override
            Type
            ServiceType
        {
            get
            {
                return typeof(LoggingModuleService);
            }
        }

        /// <summary>
        /// Gets a culture-specific friendly name for the module.
        /// </summary>
        public override
            String
            FriendlyName
        {
            get
            {
                return "IIS Logging";
            }
        }

        /// <summary>
        /// Determines if the current module can be supported in the current ManagementScope.
        /// </summary>
        /// <param name="scope">The ManagementScope the administrative user is currently viewing in the IIS Management Console.</param>
        /// <remarks>
        /// As a user navigates the IIS management user interface, the scope will be reset to either Server, Site, or Application levels.
        /// This method determines if the module supports the level the administrative user is currently viewing.
        /// </remarks>
        /// <returns>A value indicating if the module supports the current management scope.</returns>
        public override Boolean
            SupportsScope(ManagementScope scope)
        {
            return (scope == ManagementScope.Server) ||
                   (scope == ManagementScope.Site);
        }

        /// <summary>
        /// Gets the module definition for the LoggingUiModule
        /// </summary>
        /// <param name="context">The management context of the LoggingUiModule</param>
        /// <returns>An IManagementContext for the LoggingUiModule.</returns>
        public override
            ModuleDefinition
            GetModuleDefinition(IManagementContext context)
        {
            return new ModuleDefinition(Name,
                typeof(LoggingModule).AssemblyQualifiedName);
        }

    }
}
